//网络请求配置项
import 'package:dio/dio.dart';

class HttpConfig {
  // 单例
  static final HttpConfig _config = HttpConfig._internal();
  factory HttpConfig() {
    return _config;
  }
  HttpConfig._internal();

  //域名
  String baseURL = "";

  //请求头
  Map<String, dynamic> Function() headers = () {
    return {};
  };

  //公共参数
  Map<String, dynamic> Function() publicParams = () {
    return {};
  };

  //请求超时
  Duration? connectTimeout;

  //是否需要加解密
  bool isNeedCrypt = true;

  //实际返回参数的code键
  String codeKey = "code";
  //实际返回参数的message键
  String msgKey = "msg";
  //实际返回参数的data键
  String dataKey = "data";

  //业务逻辑成功的code
  int successCode = 0;
  //业务逻辑失败的code
  List<int> failCodeList = [];
  //统一的业务逻辑错误回调
  late Function(int code, String? msg) failCallBack;

  //加解密拦截器
  Interceptor? cryptInterceptor;
}
